
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>">
<meta http-equiv="Access-Control-Allow-Origin" content="*">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/Yhmain.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="css/other.css" />
<link href="css/pl.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/jquery.min.js"></script> 
<script src="js/bqb.js"></script> 
<title>智行校园-精准化服务平台</title>
</head>
<body>
<input id="the_value" value="我的分享" style="display:none"/>
<input name="userid" value="" style="display:none"/>
    <!--内容-->
    <div class="container">
        <!--内容-右边容器-->
    	<div class="col-2 leftcol the_lcontainer"></div>
        <div class="col-8 text-left bg-color-white">
        	<div class="pl40 pr120">
            	<div class="lineaH60 ">
            		<h3>我的分享</h3>
            	</div>
                <div class="pt10 pb10 float-r">
                        <form>
                            <input class="line-h-32" style="width:23.75em;height:2.0em;"/>
                            <input type="button" class="btn border-rad5 line-h-32 search_input_button" style="width:5.625em;" value="搜索"  />
                        </form>
                </div>
                <div class="clear-b col-Fill-8 mt40" >
                   <div class="clear-b" id="the_share_square"></div>
                    <div class="loaddiv" style="display:none;height:2em;text-align: center;width: 100%;">  
                      <img src="img/loading.gif"  height="100%" style="width:2em;margin-right:1em"/> 正在加载。。。
                    </div> 
                </div>
            <!-- 右边 -->
                <div class="bg-color-red col-Fill-2 pt10 text-left" height=100%>
                	<div class="ml40">
                		<a class="font-size-h3 ">最近</a>
                		<div class="pt10 mt10li">
                			<ul id="sjz"></ul>
                		</div>
                	</div>
                	
                </div>
    	</div>
</div></div>
<script  type="text/javascript">
var page = 1;
var gPageSize = 10; 
var total_share_targets;
var user_id = '<%=session.getAttribute("userid")%>';
var user_name = '<%=session.getAttribute("username")%>';
var ticket = '<%=session.getAttribute("ticket")%>';
$('input[name=userid]').attr('value',user_id);
var user_img='';
$.getJSON('/WDDXSERVER/targetsquare/getShareNumber?ticket='+ticket,{userid:user_id},function(data){
	total_share_targets=data[0].total;
	user_img=data[0].url;
/* 	user_name=data[0].name; */
	$('#user_img').attr('src',data[0].url);
	$('div#btn div.the_user_name').text(data[0].name);
	 my_square("/WDDXSERVER/targetsquare/getMyShare",{userid:user_id,cxtj:'',ticket:ticket,time:'',pageSize:gPageSize,pagenum:page});
});
Array.prototype.unique3 = function(){
   var res = [];
   var yf = [];
   for(var i = 0 ; i<this.length;i++){
   console.log($.inArray(this[i].yue,yf));
      var b = ($.inArray(this[i].yue,yf) >= 0 && this[i].cx != "last" && this[i].cx != "first"? "" : this[i].yue);
      if(b){
         yf.push(b);
         b = JSON.stringify(this[i]);
         res.push(b);
      }
   }
 return res;
}
$.ajax({
	url:'/WDDXSERVER/targetsquare/getShareTime',
	data:{userid:user_id,ticket:ticket},
	type:'post',
	dataType:'text',
	success: function(data){
		var data1 = eval('('+data+')');
		$.each(data1,function(index,rec){
			var html = '<a class="clear-b" style="width:120px;color:black;" href="javascript:;">'+
            					'<li class="the_father">'+
            						'<div class="in-block bg-color-blue float-l border-rad5" style="height:60px;width:9px;">'+
            						'</div>'+
            						'<span>'+rec["nian"]+'</span>'+
            					'</li>'+
            				'</a>';
            if(rec.child.length>0){
          if(index==0)
            var html1 ='<li class="the_child">'+
            				'<div class="clear-b">'+
            				'</div>'+		
            			'</li>';
           else				
        	  var html1 ='<li class="the_child" style="display:none">'+
				                 '<div class="clear-b">'+
				                 '</div>'+		
			                 '</li>';
            			
            var html2 = html1.split('</div>')[0];
            	 $.each(rec.child.unique3(),function(index,rec1){
            	  rec1 = eval('('+rec1+')');
            	  if(rec1["cx"]=="first"){
            	 	html2+='<div class="in-block bg-color-blue float-l border-rad5" style="height: 12px;width:12px;margin-top:24px;">'+
            							'</div>'+'<a  href="javascript:;" style="float:left;padding-left:25px;line-height:60px;font-size:12px; color:black;">'+"第一条分享"+'</a>'
            	 }else if(rec1["cx"]=="last"){
            	 	html2+='<div class="in-block bg-color-blue float-l border-rad5" style="height: 12px;width:12px;margin-top:24px;">'+
            							'</div>'+'<a href="javascript:;" style="float:left;padding:0px 25px;line-height:60px;color:black;">'+rec1["yue"]+"月"+'</a>'
            	 }else{
            		 html2+='<div class="in-block bg-color-blue float-l" style="height:60px;width:12px;">'+
            							'</div>'+'<a href="javascript:;" style="float:left;padding:0px 25px;line-height:60px;color:black;">'+rec1["yue"]+"月"+'</a>'
            	 }
            	}); 
            	html1 = html2+html1.split('</li>')[0];
                html+=html1;
            }
           $("#sjz").append(html);
		}); 
		$('#sjz li.the_father').click(function(){
			   if($(this).parent().next().attr('class')=='the_child')
				   $(this).parent().next().toggle('slow');
			      $(this).parent().next().next().toggle('slow'); 
		});
		$('#sjz li.the_child a').click(function(){
			var the_month=$(this).text();
			var month=$(this).parents('li.the_child').prev().find('span').text()+'-'+the_month.substring(0,the_month.length-1);
			page=1;
			$('div#the_share_square div[name=onejl]').remove();
			 my_square('/WDDXSERVER/targetsquare/getMyShare',{userid:user_id,ticket:ticket,cxtj:encodeURI($(this).prev().val()),time:month,pageSize:gPageSize,pagenum:page});
		})
	}
});
$('input.search_input_button').click(function(){
	 $('div#the_share_square').empty();
	   page=1;
	   my_square('/WDDXSERVER/targetsquare/getMyShare',{userid:user_id,ticket:ticket,cxtj:encodeURI($(this).prev().val()),time:'',pageSize:gPageSize,pagenum:page});
});
//获取滚动条当前的位置
function getScrollTop() {
   var scrollTop = 0;
   if (document.documentElement && document.documentElement.scrollTop) {
        scrollTop = document.documentElement.scrollTop;
       }
   else if (document.body) {
        scrollTop = document.body.scrollTop;
      }
   return scrollTop;
 }

//获取当前可是范围的高度
function getClientHeight() {
   var clientHeight = 0;
   if (document.body.clientHeight && document.documentElement.clientHeight) {
    clientHeight = Math.min(document.body.clientHeight, document.documentElement.clientHeight);
    }
   else {
    clientHeight = Math.max(document.body.clientHeight, document.documentElement.clientHeight);
    }
    return clientHeight;
}

//获取文档完整的高度
function getScrollHeight() {
    return Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
} 
window.onscroll = function(){ 
	var the_length=$('div#the_share_square div[name=onejl]').length;
	   if(0<(parseInt(total_share_targets)-parseInt(the_length))){
		if (getScrollTop() + getClientHeight() == getScrollHeight()) {
			 my_square("/WDDXSERVER/targetsquare/getMyShare",{userid:user_id,cxtj:'',time:'',ticket:ticket,pageSize:gPageSize,pagenum:page});	
		 } 
	    }
	   else{

		   $('div.loaddiv').hide();
	   }
}; 
function my_square(url,param){
	page++;
   $.getJSON(url,param,function(data,status,xhr){
	 $(".loaddiv").show();  
	data = data.content.message;
	if(status=='success'){
	  for(var i=0;i<data.length;i++){
		  var the_status='';
		  var the_operate='';
		  if(data[i].state=='0')
			  the_status='点赞';
		  else
			  the_status='取消赞'	; 
		  if(data[i].operate=='1')
			  the_operate='加入我的目标';
		  else
			  the_operate='已加入日常目标'	; 
		  var str='';
		 str+='<div name="onejl" data-id="'+data[i].id+'">'+
		  '<div style="border:1px #cbc7c7 solid;" class="pl20 pt20">'+
		  	'<div><div class="header-photo bg-color-gray float-l" >'+
		  	   '<img  src="'+data[i].path+'" width="100%" height="100%"/></div>'+
		  		'<div class="float-l pt10 ml10 text-left">'+
		  			'<a class="font-size-h3">'+data[i].s_user+'</a>'+
		  			'<div class="in-block pt20 color-gray-word" style="font-size:14px;">'+
		  			  data[i].s_date+'<span class="ml20">'+data[i].mbtype+
		  			 '</span><a href="#"><img src="img/liulan_03.png" alt="" class="ml20" height="14px;"/></a><a style="margin-left:4px;">浏览   ('+data[i].browse+')</a></div>'+
		  		'</div></div><div class="pt10 clear-b text-left"><a>'+data[i].title+'</a></div>'+
		  	   '<div class="text-left md20 border-all pd10 bg-color-qyellow"><div style="font-size:18px;">'+data[i].mbtitle+'</div>'+
		  		'<a class="block pt10">描述：'+data[i].ms+'</a><a class="block pt10 color-blue" href="javascript:" name="showAll">展开全部</a>'+
		  		'<div class="pt10" ><a class="block float-l pr10">展开任务分解</a><img name="qh" src="img/sanjiao_03.png" height="19px;" style="float:left;"/><div class="clear-b"></div></div>'+
		  		'<table name="table_'+data[i].id+'" class="mt20 my-table " width="100%">'+
		  		'<tbody><tr><td>序号</td><td>描述</td><td>签到次数</td><td>相关资料</td></tr></tbody></table></div><div class="clear-b"></div></div>'+
		         '<div class="text-left border-l border-r" >'+
		  	    '<a class="block border-r pd10-plr20 float-l" name="pinglun" href="div[name=main-pl]"><div class="float-l" style="width:25px;height:25px;">'+
		  	    '<img src="img/pinlun_03.png" height=100%/></div><div class="float-l color-blue" style="line-height:25px;margin-left:0.4em"><span>评论</span></div></a>'+
		  	    '<a class="block border-r pd10-plr20 float-l"  name="pinglun" href="#" ><div class="float-l" style="width:25px;height:25px;"><img src="img/dianzan_03.png" height=100%/>'+
		  		'</div><div class="float-l color-blue" style="line-height:25px;margin-left:0.4em"><span name="dianzan" data-operate="'+data[i].state+'">'+the_status+'('+data[i].zan+')</span></div></a>'+
		  	    '<div class="clear-b"></div> </div><div class="pd20 border-all bg-color-qyellow text-right" style="padding-top:0px;">'+
		  			'<div class="text-left mb10 mt10 dianzan_object" name="dianzan_object_'+data[i].id+'"><img src="img/mbgc_11.png" class="zan_sign" ></div>'+
		             '<div id="pllb_'+data[i].id+'" style="margin-top:0.5em"></div> <div class="Input_Box" name="main-pl"> <div contenteditable="true" class="Input_text"></div><div style="display:none;" id="btnpl">'+
		  	      	 '<div class="faceDiv"> </div>'+
		  	      	 '<div class="Input_Foot"> <a onmouseover="onmous1(this)" onmouseout="onmousout1(this)" class="imgBtnPC" href="javascript:void(0);"></a><a class="postBtnPc" onmouseover="onmous1(this)" onmouseout="onmousout1(this)">确定</a> </div></div></div></div></div>';
		  	      	
		  	      	 $('div#the_share_square').append(str);
		  	      	 for(var j=0;j<data[i].table.length;j++)
		  	          	$('table[name="table_'+data[i].id+'"] tbody').append('<tr><td>'+data[i].table[j].c_id+'</td><td>'+data[i].table[j].c_name+'</td><td>'+data[i].table[j].c_daynum+'</td><td>'+data[i].table[j].c_resource+'</td></tr>');
		  	      	 $('a[name=showAll]').unbind('click').bind('click',function(){
		  	  		   var url1 = "img/sanjiao_01.png";
		  	  		   var url2 = "img/sanjiao_03.png";
		  	  		   if($('table').css("display")=="none"){
		  	  			 $('img[name=qh]').attr("src",url2); 
		  	  		   }else{
		  	  		 	$('img[name=qh]').attr("src",url1);  
		  	  		    }
		  	  		     $(this).siblings('table').toggle();
		  	         });
		  	       $('div[name=main-pl] div.Input_text').unbind('blur').bind('blur',function(){
		  	    	  
			  			if(!$(this).parent().find('.postBtnPc').hasClass("active1")&&!$(this).parent().find('.imgBtnPC').hasClass("active1") && !$(this).parent().find('img').hasClass("active")){
			  				$(this).parent().css("height","30px");
			  				$(this).css("height","20px");
			  				$(this).parent().find(' .faceDiv').css("display","none");
			  			}
			  		});
		  	     $('div[name=main-pl] div.Input_text').unbind('focus').bind('focus',function(){
		 			$(this).parent().css("height","110px");
		 			$(this).css("height","60px");
		 			$(this).parent().find(' #btnpl').css("display","block");
		 			});
		  	     
		  	   $('a[name=pinglun]').unbind('click').bind('click',function(event){
		  		 if($(this).find('span').text()=='评论'){
		  			 $(this).parent().next().find('.Input_text').focus();
		  		   }
		  		 else if($(this).find('span').attr('name')=='dianzan'){
		  			 var id=$(this).parent().parent().attr('data-id');
		  			 if($(this).find('span').attr('data-operate')=='0'){
		  			     operate_zan({userid:user_id,s_id:id,state:'1',ticket:ticket});
		  			     $(this).find('span').text('取消赞 ('+(parseInt($(this).find('span').text().match(/\d+/g))+1)+')');
		  			     $(this).find('span').attr('data-operate','1');
		  			    var $the_id_dom=$(this).parents('div[name=onejl]');
		  			  $('div[name=dianzan_object_'+$the_id_dom.attr('data-id')+']').css('display','block');
		  			       $('div[name=dianzan_object_'+$the_id_dom.attr('data-id')+'] img.zan_sign').after('<img data-bz="myself_dianzan" src="'+user_img+'" >');
		  			  if(parseInt($(this).find('span').text().match(/\d+/g))>6)
			  				 $('div[name=dianzan_object_'+$the_id_dom.attr('data-id')+'] span').text('共'+parseInt($(this).find('span').text().match(/\d+/g))+'人点赞');
		  			 }
		  			 else{
		  				$(this).find('span').text('点赞 ('+(parseInt($(this).find('span').text().match(/\d+/g))-1)+')');
		  				 operate_zan({userid:user_id,s_id:id,state:'-1',ticket:ticket});
		  				 $(this).find('span').attr('data-operate','0');
		  				 if(parseInt($(this).find('span').text().match(/\d+/g))==0)
			  				 $('div[name=dianzan_object_'+$(this).parents('div[name=onejl]').attr('data-id')+']').css('display','none');
		  				 if(parseInt($(this).find('span').text().match(/\d+/g))>6)
			  				 $('div[name=dianzan_object_'+$(this).parents('div[name=onejl]').attr('data-id')+'] span').text('共'+parseInt($(this).find('span').text().match(/\d+/g))+'人点赞');
		  				 $('div[name=dianzan_object_'+$(this).parents('div[name=onejl]').attr('data-id')+'] img[data-bz=myself_dianzan]').remove();
		  				
		  			 }
		  		  }
		  		
		  		return false;
		  	});
		  	 if(data[i].zan>0)
		  	    get_dianzan(data[i].id);
		  	 else if(data[i].zan==0)
		  		$('div[name=dianzan_object_'+data[i].id+']').css('display','none');
		  	 get_comments(data[i].id);
		  	//  $(".loaddiv").hide(); 
	  }
	 
	}
});
};
function get_dianzan(param){
	  $.ajax({
			url:'/WDDXSERVER/targetsquare/getThumbsUp',
		    data:{userid:user_id,s_id:param},
		    type:'post'
		 }).done(function(data){
			 for(var m=0;m<data.length;m++){
	      		 if(m<=6 && data[m].bs =='1')
	      			$('div[name=dianzan_object_'+param+']').append('<img data-bz="myself_dianzan" src="'+data[m].path+'" >');
	      		 else if(m<=6 && data[m].bs =='0')
	      			$('div[name=dianzan_object_'+param+']').append('<img src="'+data[m].path+'" >');
	      		 else{
	      			$('div[name=dianzan_object_'+param+']').append('<span>共'+data.length+'人点赞</span>'); 
	      		    break;	
	      		 }
	      	 } 
		 });
}
function operate_zan(param){
    $.ajax({
		url:'/WDDXSERVER/targetsquare/thumbsUpShare',
	    data:param,
	    type:'post'
			 });}	
function onmous(a){
	$(a).addClass("active");
}
function onmousout(a){
	$(a).removeClass("active");
}
function onmous1(a){
	$(a).addClass("active1");
}
function onmousout1(a){
	$(a).removeClass("active1");
}
function get_comments(s_id){
	//跨域取数据
	$.getJSON("/WDDXSERVER/targetsquare/getComment?userid="+user_id+"&s_id="+s_id+"&ticket="+ticket,function(data,status,xhr){
		var dom = $('#pllb_'+s_id);
	//绑定数据
		var htmlroot = null;
		data = data.content.message;
		$.each(data,function(index,rec){
		if(rec["bjzd"] == 0){
		   var Reply= rec["a_content"];
		   	dom.append(htmlroot);	
			htmlroot = null;
			htmlroot = '<div class="text-left mb10" style="font-size:10px;">'+
		                		'<div class="float-l" style="width:29px;height:29px;"><img src='+rec["faceaddress"]+' width=100%>'+'</div>'+
		                		'<div class="float-l ml10" style="width:90%;">'+
		                			'<div>'+
			                			'<div class="ml3">'+'<a href="#" data-id="'+rec["com_id"]+'" data-comment="'+rec["a_id"]+'">'+rec["a_answer_name"]+'</a>'+"："+Reply+'</div>'+
			                			'<div class="color-gary ">'+rec["a_date"]+
			                				'<a name="p1" href="javascript:;" class="ml10">'+'<img src="img/mbgc_12.png" height="13px">'+'</a>';
			                	if(rec["operate"]==1)
			                		htmlroot+='<a class="comment_delete"></a></div>';
			                    else
			                    	htmlroot+='</div>';	
			                    
			                    	htmlroot+='<div class="Input_Box1" style="display:none;" name="annex-pl">'+
			                			'<div contenteditable="true" class="Input_text" name="textpl"></div>'+
										      '<div >'+
										      	 '<div class="faceDiv">'+'</div>'+
										      	 '<div class="Input_Foot">'+'<a onmouseover="onmous(this)" onmouseout="onmousout(this)" class="imgBtnPC" name="imgBtnPC1" href="javascript:void(0);">'+'</a>'+'<a class="postBtnPc" onmouseover="onmous(this)" onmouseout="onmousout(this)" name="postBtnPc1">'+"确定"+'</a>'+'</div>'+
										      '</div>'+
									    '</div>'+
		                			'</div>'+
		                		/* 	二级评论 */
		                		'<div>'+
		                				'<span name="mypl" class="clear-b">'+'</span>'+
		                		'</div>'+
		                		'</div>'+
		                		'<div class="clear-b">'+'</div>'+
		                	'</div>'
		}else{
		     var a;
		     var html = '<div class="pt5">'+
		                				'<div class="float-l" style="width:29px;height:29px;">'+'<img src='+rec["faceaddress"]+' width=100%>'+'</div>'+
			                				'<div class="float-l ml10" style="width:90%;">'+
			                				'<div class="ml3 text-left">'+'<a href="#" data-comment="'+rec["a_id"]+'" >'+rec["a_answer_name"]+'</a>'+'<span class="color-black">'+"：回复		"+'<span>'+'<a href="#">'+rec["a_be_answer_name"]+'</a>'+"："+rec["a_content"]+'</div>'+
			                			    '<div class="color-gary">'+rec["a_date"]+'<a name="p1" href="javascript:;" class="ml10">'+'<img src="img/mbgc_12.png" height="13px">'+'</a>';
			                			    if(rec["operate"]==1)
			                			    	html+='<a class="comment_delete"></a></div>';
						                    else
						                    	html+='</div>';	
			               
			                				html+='<div class="Input_Box1" style="display:none;" name="annex-pl">'+
											      '<div contenteditable="true" class="Input_text" name="textpl"></div>'+
											      '<div >'+
											      	 '<div class="faceDiv">'+'</div>'+
											      	 '<div class="Input_Foot">'+'<a onmouseover="onmous(this)" onmouseout="onmousout(this)" class="imgBtnPC" name="imgBtnPC1" href="javascript:void(0);">'+'</a>'+'<a class="postBtnPc" onmouseover="onmous(this)" onmouseout="onmousout(this)" name="postBtnPc1">'+"确定"+'</a>'+'</div>'+
											      '</div>'+
									    	' </div>'+
			                			'</div>'+
			                			'<div class="clear-b">'+'</div>'+
		                			'</div>';
		    if(htmlroot){
		        a = htmlroot.split('<span name="mypl" class="clear-b">'+'</span>');
		        htmlroot=a[0]+html+'<span name="mypl" class="clear-b">'+'</span>'+a[1];
		    }else{
		        htmlroot=html+'<span name="mypl" class="clear-b">'+'</span>';
		       
		    }
			
		    
		}
		
				
		});
		dom.append(htmlroot);
		comment_control(s_id)
	});
	
};
function getNowFormatDate() {
    var date = new Date();
    var seperator1 = "-";
    var seperator2 = ":";
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }
    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
            + " " + date.getHours() + seperator2 + date.getMinutes()
            + seperator2 + date.getSeconds();
    return currentdate;
} 
function comment_control(s_id){
	  $("a[name=p1]").unbind('click').bind('click',function(){
		 var s_id=$(this).parents('div[name=onejl]').attr('data-id');
		 $('#pllb_'+s_id).parent().find('div[class*=Input_Box]').css("display","none");
		 $(this).parent().next().css("display","block");
		 $(this).parent().next().find('div[name=textpl]').focus();
	});
	  $("a.comment_delete").unbind('click').bind('click',function(){
		  var the_comment='';
		  //回复id；
		  the_comment=$(this).parent().prev().find('a').attr('data-comment');
		  //分享id
		  var the_s_id=$(this).parents('div[name=onejl]').attr('data-id');
			if($(this).parent().parent().parent().attr('class')=='pt5'){
				var the_reply=$(this).parents('div.pt5').parent().prev().children('div.ml3').find('a').attr('data-id');
				$(this).parents('div.pt5').remove();
				$.getJSON("/WDDXSERVER/targetsquare/deleteReply",{userid:user_id,ticket:ticket,s_id:the_s_id,com_id:the_reply,a_id:the_comment},function(data,status,xhr){
				});
				}
			else{ 
				var the_reply=$(this).parents('div.color-gary').prev().find('a').attr('data-id');
			
				$(this).parent().parent().parent().parent().remove();
				$.getJSON("/WDDXSERVER/targetsquare/deleteComments",{userid:user_id,ticket:ticket,s_id:the_s_id,com_id:the_reply},function(data,status,xhr){
					
				});	
			}
		});
	$('div[name=annex-pl] div.Input_text').bind('blur',function(){
		$(this).focus();
		if(!$('a[name=postBtnPc1]').hasClass("active") && !$('a[name=imgBtnPC1]').hasClass("active") && !$('img').hasClass("active")){
			$(this).parent().css("display","none");
			$('div[name=main-pl]').css("display","block");
			$('div[name=main-pl] div.Input_text').css("height","20px");
		}
	});
	//绑定表情包
		ImgIputHandler.Init();
		$(".postBtnPc").click(function(){
			$(this).parent().parent().prev().focus();
			var the_comment=$(this).parent().parent().prev().html();
		    var the_s_id=$(this).parents('div[name=onejl]').attr('data-id');
		    var $the_dom='';
		    if(the_comment!=''){
			if(typeof($(this).parent().parent().attr('id'))=='undefined'){
				var the_a_id=$(this).parents('.Input_Box1').prev().prev().find('a:eq(0)').attr('data-comment');
				var a_name=$(this).parents('.Input_Box1').prev().prev().find('a:eq(0)').text();
				if($(this).parents('div.pt5').length==0){
					$the_dom=$(this).parents('div.Input_Box1').parent().next();
				}
					
				else
				 $the_dom=$(this).parents('div.pt5').parent();
				paint_comment($the_dom,'1',"/WDDXSERVER/targetsquare/answer",{userid:user_id,ticket:ticket,s_id:the_s_id,a_id:the_a_id,content:encodeURI(the_comment)},a_name);
			
			}
			else{
				 $the_dom=$(this).parents('div.Input_Box').prev();
				paint_comment($the_dom,'0',"/WDDXSERVER/targetsquare/comment",{userid:user_id,ticket:ticket,s_id:the_s_id,content:encodeURI(the_comment)},'');
			
			}}
			
			$(this).parent().parent().prev().html('');
			$(this).parent().parent().prev().parent().css('display','none');
			$('div[name=main-pl]').css({'display':'block','height':'30px'});
			$('div[name=main-pl]').find('div.Input_text').css({'height':'20px'});
		});
	
};
var date = new Date(); 
function paint_comment(id,sign,url,param,a_name){
	$.getJSON(url,param,function(data){
		var html='';
		data =data.content.message;
		if(sign=='1'){
		html+='<div class="pt5">'+
			'<div class="float-l" style="width:29px;height:29px;">'+'<img src='+user_img+' width=100%>'+'</div>'+
				'<div class="float-l ml10" style="width:90%;">'+
				'<div class="ml3 text-left">'+'<a href="#" data-id="'+data.com_id+'" data-comment="'+data.a_id+'" >'+user_name+'</a>'+'<span class="color-black">'+"：回复		"+'<span>'+'<a href="#">'+a_name+'</a>'+"："+decodeURI(param.content)+'</div>'+
			    '<div class="color-gary">'+data.time+'<a name="p1" href="javascript:;" class="ml10">'+'<img src="img/mbgc_12.png" height="13px">'+'</a><a class="comment_delete"></a>'+'</div>'+
				 '<div class="Input_Box1" style="display:none;" name="annex-pl">'+
				      '<div contenteditable="true" class="Input_text" name="textpl"></div>'+
				      '<div >'+
				      	 '<div class="faceDiv">'+'</div>'+
				      	 '<div class="Input_Foot">'+'<a onmouseover="onmous(this)" onmouseout="onmousout(this)" class="imgBtnPC" name="imgBtnPC1" href="javascript:void(0);">'+'</a>'+'<a class="postBtnPc" onmouseover="onmous(this)" onmouseout="onmousout(this)" name="postBtnPc1">'+"确定"+'</a>'+'</div>'+
				      '</div>'+
		    	' </div>'+
			'</div>'+
			'<div class="clear-b">'+'</div>'+
		'</div>';

		}else{
			html+='<div class="text-left mb10" style="font-size:10px;">'+
			'<div class="float-l" style="width:29px;height:29px;"><img src='+user_img+' width=100%>'+'</div>'+
			'<div class="float-l ml10" style="width:90%;">'+
				'<div>'+
	    			'<div class="ml3">'+'<a href="#" data-id="'+data.com_id+'" data-comment="'+data.a_id+'">'+user_name+'</a>'+"："+decodeURI(param.content)+'</div>'+
	    			'<div class="color-gary ">'+data.time+
	    				'<a name="p1" href="javascript:;" class="ml10">'+'<img src="img/mbgc_12.png" height="13px">'+'</a><a class="comment_delete"></a>'+
	    			'</div>'+
	    			'<div class="Input_Box1" style="display:none;" name="annex-pl">'+
	    			'<div contenteditable="true" class="Input_text" name="textpl"></div>'+
					      '<div >'+
					      	 '<div class="faceDiv">'+'</div>'+
					      	 '<div class="Input_Foot">'+'<a onmouseover="onmous(this)" onmouseout="onmousout(this)" class="imgBtnPC" name="imgBtnPC1" href="javascript:void(0);">'+'</a>'+'<a class="postBtnPc" onmouseover="onmous(this)" onmouseout="onmousout(this)" name="postBtnPc1">'+"确定"+'</a>'+'</div>'+
					      '</div>'+
				    '</div>'+
				'</div>'+
			/* 	二级评论 */
			'<div>'+
					'<span name="mypl" class="clear-b">'+'</span>'+
			'</div>'+
			'</div>'+
			'<div class="clear-b">'+'</div>'+
		'</div>';
		}
		id.append(html);
		comment_control(param.param1);
		
		
	});
};

</script>
<script type="text/javascript" src="js/header.js"></script>
<script type="text/javascript" src="js/leftcol.js"></script>
</body>
</html>
